package com.lzh.es.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhehen.lu
 * @date 2025/8/14 13:42
 */
@Configuration
@ConfigurationProperties(
        prefix = "lzh.es"
)
public class EsProperties {
    private String nodes;
    private String host;
    private Integer port;
    private String schema;
    private String username;
    private String password;
    private Integer socketTimeout;
    private Integer connectTimeout;
    private Integer connectRequestTimeout;
    private Integer maxConnectNum;
    private Integer maxConnectPerRoute;
    private Integer keepAliveTime;

    public EsProperties() {
    }

    public String getNodes() {
        return this.nodes;
    }

    public String getHost() {
        return this.host;
    }

    public Integer getPort() {
        return this.port;
    }

    public String getSchema() {
        return this.schema;
    }

    public String getUsername() {
        return this.username;
    }

    public String getPassword() {
        return this.password;
    }

    public Integer getSocketTimeout() {
        return this.socketTimeout;
    }

    public Integer getConnectTimeout() {
        return this.connectTimeout;
    }

    public Integer getConnectRequestTimeout() {
        return this.connectRequestTimeout;
    }

    public Integer getMaxConnectNum() {
        return this.maxConnectNum;
    }

    public Integer getMaxConnectPerRoute() {
        return this.maxConnectPerRoute;
    }

    public Integer getKeepAliveTime() {
        return this.keepAliveTime;
    }

    public void setNodes(String nodes) {
        this.nodes = nodes;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public void setSchema(String schema) {
        this.schema = schema;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setSocketTimeout(Integer socketTimeout) {
        this.socketTimeout = socketTimeout;
    }

    public void setConnectTimeout(Integer connectTimeout) {
        this.connectTimeout = connectTimeout;
    }

    public void setConnectRequestTimeout(Integer connectRequestTimeout) {
        this.connectRequestTimeout = connectRequestTimeout;
    }

    public void setMaxConnectNum(Integer maxConnectNum) {
        this.maxConnectNum = maxConnectNum;
    }

    public void setMaxConnectPerRoute(Integer maxConnectPerRoute) {
        this.maxConnectPerRoute = maxConnectPerRoute;
    }

    public void setKeepAliveTime(Integer keepAliveTime) {
        this.keepAliveTime = keepAliveTime;
    }

    @Override
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof EsProperties)) {
            return false;
        } else {
            EsProperties other = (EsProperties)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                label155: {
                    Object this$nodes = this.getNodes();
                    Object other$nodes = other.getNodes();
                    if (this$nodes == null) {
                        if (other$nodes == null) {
                            break label155;
                        }
                    } else if (this$nodes.equals(other$nodes)) {
                        break label155;
                    }

                    return false;
                }

                Object this$host = this.getHost();
                Object other$host = other.getHost();
                if (this$host == null) {
                    if (other$host != null) {
                        return false;
                    }
                } else if (!this$host.equals(other$host)) {
                    return false;
                }

                Object this$port = this.getPort();
                Object other$port = other.getPort();
                if (this$port == null) {
                    if (other$port != null) {
                        return false;
                    }
                } else if (!this$port.equals(other$port)) {
                    return false;
                }

                label134: {
                    Object this$schema = this.getSchema();
                    Object other$schema = other.getSchema();
                    if (this$schema == null) {
                        if (other$schema == null) {
                            break label134;
                        }
                    } else if (this$schema.equals(other$schema)) {
                        break label134;
                    }

                    return false;
                }

                label127: {
                    Object this$username = this.getUsername();
                    Object other$username = other.getUsername();
                    if (this$username == null) {
                        if (other$username == null) {
                            break label127;
                        }
                    } else if (this$username.equals(other$username)) {
                        break label127;
                    }

                    return false;
                }

                label120: {
                    Object this$password = this.getPassword();
                    Object other$password = other.getPassword();
                    if (this$password == null) {
                        if (other$password == null) {
                            break label120;
                        }
                    } else if (this$password.equals(other$password)) {
                        break label120;
                    }

                    return false;
                }

                Object this$socketTimeout = this.getSocketTimeout();
                Object other$socketTimeout = other.getSocketTimeout();
                if (this$socketTimeout == null) {
                    if (other$socketTimeout != null) {
                        return false;
                    }
                } else if (!this$socketTimeout.equals(other$socketTimeout)) {
                    return false;
                }

                label106: {
                    Object this$connectTimeout = this.getConnectTimeout();
                    Object other$connectTimeout = other.getConnectTimeout();
                    if (this$connectTimeout == null) {
                        if (other$connectTimeout == null) {
                            break label106;
                        }
                    } else if (this$connectTimeout.equals(other$connectTimeout)) {
                        break label106;
                    }

                    return false;
                }

                Object this$connectRequestTimeout = this.getConnectRequestTimeout();
                Object other$connectRequestTimeout = other.getConnectRequestTimeout();
                if (this$connectRequestTimeout == null) {
                    if (other$connectRequestTimeout != null) {
                        return false;
                    }
                } else if (!this$connectRequestTimeout.equals(other$connectRequestTimeout)) {
                    return false;
                }

                label92: {
                    Object this$maxConnectNum = this.getMaxConnectNum();
                    Object other$maxConnectNum = other.getMaxConnectNum();
                    if (this$maxConnectNum == null) {
                        if (other$maxConnectNum == null) {
                            break label92;
                        }
                    } else if (this$maxConnectNum.equals(other$maxConnectNum)) {
                        break label92;
                    }

                    return false;
                }

                Object this$maxConnectPerRoute = this.getMaxConnectPerRoute();
                Object other$maxConnectPerRoute = other.getMaxConnectPerRoute();
                if (this$maxConnectPerRoute == null) {
                    if (other$maxConnectPerRoute != null) {
                        return false;
                    }
                } else if (!this$maxConnectPerRoute.equals(other$maxConnectPerRoute)) {
                    return false;
                }

                Object this$keepAliveTime = this.getKeepAliveTime();
                Object other$keepAliveTime = other.getKeepAliveTime();
                if (this$keepAliveTime == null) {
                    if (other$keepAliveTime != null) {
                        return false;
                    }
                } else if (!this$keepAliveTime.equals(other$keepAliveTime)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(Object other) {
        return other instanceof EsProperties;
    }

    @Override
    public int hashCode() {
        int result = 1;
        Object nodes = this.getNodes();
        result = result * 59 + (nodes == null ? 43 : nodes.hashCode());
        Object host = this.getHost();
        result = result * 59 + (host == null ? 43 : host.hashCode());
        Object port = this.getPort();
        result = result * 59 + (port == null ? 43 : port.hashCode());
        Object schema = this.getSchema();
        result = result * 59 + (schema == null ? 43 : schema.hashCode());
        Object username = this.getUsername();
        result = result * 59 + (username == null ? 43 : username.hashCode());
        Object password = this.getPassword();
        result = result * 59 + (password == null ? 43 : password.hashCode());
        Object socketTimeout = this.getSocketTimeout();
        result = result * 59 + (socketTimeout == null ? 43 : socketTimeout.hashCode());
        Object connectTimeout = this.getConnectTimeout();
        result = result * 59 + (connectTimeout == null ? 43 : connectTimeout.hashCode());
        Object connectRequestTimeout = this.getConnectRequestTimeout();
        result = result * 59 + (connectRequestTimeout == null ? 43 : connectRequestTimeout.hashCode());
        Object maxConnectNum = this.getMaxConnectNum();
        result = result * 59 + (maxConnectNum == null ? 43 : maxConnectNum.hashCode());
        Object maxConnectPerRoute = this.getMaxConnectPerRoute();
        result = result * 59 + (maxConnectPerRoute == null ? 43 : maxConnectPerRoute.hashCode());
        Object keepAliveTime = this.getKeepAliveTime();
        result = result * 59 + (keepAliveTime == null ? 43 : keepAliveTime.hashCode());
        return result;
    }

    @Override
    public String toString() {
        return "EsProperties(nodes=" + this.getNodes() + ", host=" + this.getHost() + ", port=" + this.getPort() + ", schema=" + this.getSchema() + ", username=" + this.getUsername() + ", password=" + this.getPassword() + ", socketTimeout=" + this.getSocketTimeout() + ", connectTimeout=" + this.getConnectTimeout() + ", connectRequestTimeout=" + this.getConnectRequestTimeout() + ", maxConnectNum=" + this.getMaxConnectNum() + ", maxConnectPerRoute=" + this.getMaxConnectPerRoute() + ", keepAliveTime=" + this.getKeepAliveTime() + ")";
    }
}
